package com.gogowan.agroenterprise.widget.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.gogowan.agroenterprise.R;
import com.gogowan.agroenterprise.model.CouponDjqInfo;

import java.util.List;

import u.aly.H;

public class CouponsHistoryAdapater extends BaseAdapter {
    private List<CouponDjqInfo> CouponDjqList;
    private Context context;
    private LayoutInflater inflater;
    public CouponsHistoryAdapater(Context context, List<CouponDjqInfo> CouponDjqList){
        this.context=context;
        this.CouponDjqList=CouponDjqList;
        inflater=LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return CouponDjqList.size();
    }

    @Override
    public Object getItem(int position) {
        return CouponDjqList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        Houlder houlder=null;
        if (convertView==null){
            convertView= inflater.inflate(R.layout.string_item,null);
            houlder=new Houlder();
            houlder.str=(TextView)convertView.findViewById(R.id.string_item_tv);
            convertView.setTag(houlder);
        }else {
            houlder=(Houlder)convertView.getTag();
        }
        String str="领取人："+CouponDjqList.get(position).getLqUserName()+
                "\n电话："+CouponDjqList.get(position).getLinkPhone()+
                "\n面值："+CouponDjqList.get(position).getCouponContent()+
                "\n时间："+CouponDjqList.get(position).getCancelTime();

        houlder.str.setText(str);
        return convertView;
    }
    class Houlder{
        TextView str;
    }
}
